package cn.ml.springdemo.aop;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestPerson {
    public static void main(String[] args) {
        ApplicationContext ac = new ClassPathXmlApplicationContext("ac.xml");
        System.out.println("********111.直接获取xml中id来创建实例对象************************");
        Son son1 = (Son) ac.getBean("person");
        son1.say();
        son1.makeProposal();
        System.out.println(son1);

        System.out.println("*******通过类型来加载bean，要求类型必须是唯一的*******");
        Son son2 = ac.getBean(Son.class);
        son2.say();
        son2.makeProposal();
        System.out.println(son2);
        System.out.println(son2==son1);
    }
}
